<!doctype html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/public/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/public/css/main.css">
    <style>
        .navActive{
            color:red;
        }
    </style>
</head>

<body>
<div class="banner">
    <img class="img-responsive" src="/public/images/banner.jpg" alt="">
</div>
<div class="nav-wrap">
    <div class="container">
        <div class="row">
            <ul class=" nav navbar-nav">
                {% if category=='' %}
                <li><a href="/" class="navActive">首页</a></li>
                {% else %}
                <li><a href="/">首页</a></li>
                {% endif %}

                {%for cate in categories %}
                {% if category==cate.id %}
                <li><a href="/?category={{cate.id}}" class="navActive">{{cate.name}}</a></li>
                {% else %}
                <li><a href="/?category={{cate.id}}">{{cate.name}}</a></li>
                {% endif %}

                {% endfor %}
            </ul>
        </div>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="col-lg-8 col-md-8 col-sm-8">
            {% block content %}{% endblock %}
        </div>
        <div class="col-lg-4 col-md-4 col-sm-4">
            {% if userInfo._id %}
            <div class="user-info userInfoBox">
                <h4>用户信息</h4>
                <hr>
                <p><span class="userName">{{userInfo.username}}</span></p>
                {% if userInfo.isAdmin %}
                <p><span class="userInfo">你好，管理员</span>
                    <a href="/admin">进入管理</a>
                </p>
                {% else %}
                <p><span class="userInfo">你好，欢迎光临我的博客</span></p>
                {% endif %}

                <p><a href="javascript:;" class="loginOut">退出</a></p>
            </div>
            {% else %}
            <div class="user-info loginBox">
                <h4>登录</h4>
                <hr>
                <p class="loginTip"></p>
                <form class="form-horizontal">
                    <div class="form-group">
                        <label for="inputName" class="col-sm-3 control-label">用户名</label>
                        <div class="col-sm-9">
                            <input type="email" class="form-control" name="inputName" id="inputName" placeholder="用户名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword" class="col-sm-3 control-label">密码</label>
                        <div class="col-sm-9">
                            <input type="password" class="form-control" name="inputPassword" id="inputPassword"
                                   placeholder="密码">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-3 col-sm-10">
                            <button type="button" class="btn btn-default loginBtn">登录</button>
                        </div>
                    </div>
                </form>
                <p class="text-right">
                    <span>还没注册?</span>
                    <a href="javascript:;">马上注册</a>
                </p>
            </div>

            <div class="user-info registerBox" style="display:none">
                <h4>注册</h4>
                <hr>
                <p class="formTip"></p>
                <form class="form-horizontal">
                    <div class="form-group">
                        <label for="inputName2" class="col-sm-3 control-label">用户名</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" name='inputName2' id="inputName2" placeholder="用户名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword2" class="col-sm-3 control-label">密码</label>
                        <div class="col-sm-9">
                            <input type="password" class="form-control" name='inputPassword2' id="inputPassword2"
                                   placeholder="密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-3 control-label">确认</label>
                        <div class="col-sm-9">
                            <input type="password" class="form-control" name='inputPassword3' id="inputPassword3"
                                   placeholder="确认密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-3 col-sm-9">
                            <button type="button" class="btn btn-default registerBtn" style="width:100%">注册</button>
                        </div>
                    </div>
                </form>
                <p class="text-right">
                    <span>已有账号</span>
                    <a href="javascript:;">马上登录</a>
                </p>
            </div>
            {% endif %}
            <div class="user-info">
                <h4>社区</h4>
                <hr>
                <p>
                    <a href="#">uuai</a>
                </p>
                <p>
                    <a href="#">uuai</a>
                </p>
            </div>
        </div>
    </div>

</div>
</body>
<script src="/public/js/jquery-3.3.1.min.js"></script>
<script src="/public/js/index.js"></script>
<script src="/public/js/comment.js"></script>
</html>